<template>
	<view style="padding: 30rpx;">
		<view class="classify-item" v-for="(item,index) in list" :key="index" @click="goToUrl(item.id)">
			<image class="about-me-image" :src="item.image" mode=""></image>
			<view class="about-me-title"> {{item.name}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		onShow() {
			this.getClassify()
		},
		onLoad(options) {
			console.log(options)
		},
		// //转发给朋友
		// onShareAppMessage(res){
		// 	return {
		// 		title:'五金',
		// 		path:'pages/classify/index?invite_code='+this.user_info.invite_code
		// 	}
		// },
		// //分享朋友圈
		// onShareTimeline(res){
		// 	return {
		// 		title:'五金',
		// 		path:'pages/classify/index',
		// 		query:'invite_code='+this.user_info.invite_code,
		// 	}
		// },
		methods: {
			getClassify() {
				this.$api.categoryIndex().then(res => {
					console.log(res)
					this.list = res.data
				})
			},
			goToUrl(id) {
				uni.navigateTo({
					url: '/pages/classify/second-classify?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.about-me-title {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		z-index: 1000;
		font-weight: bold;
		font-size: 40rpx;
		color: #FFFFFF;
	}

	.about-me-image {
		width: 100%;
		height: 100%;
		flex-shrink: 0;
		border-radius: 10rpx;
	}

	.classify-item {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 260rpx;
		background-size: 100% 100%;
		border-radius: 14rpx;
		margin-bottom: 30rpx;
		position: relative;
	}
</style>